package com.example;

import java.util.Arrays;
import java.util.List;

public class EmailTest {
    public static void main(String[] args) throws Exception {
        sendEmail();
    }


    public static void sendEmail() throws Exception {
        String userName = "914000408@qq.com"; // 发件人邮箱
        String password = "pjwzdgkptzpibech"; // 发件人密码
        String smtpHost = "smtp.qq.com"; // 邮件服务器

        String to = "914000408@qq.com"; // 收件人，多个收件人以半角逗号分隔
        String cc = "914000408@qq.com"; // 抄送，多个抄送以半角逗号分隔
        String subject = "这是邮件的主题"; // 主题
        String body = "这是邮件的正文"; // 正文，可以用html格式的哟
        List<String> attachments = Arrays.asList("F:\\三屏演示机器相关脚本\\sendmail.py"); // 附件的路径，多个附件也不怕

        Email email = Email.entity(smtpHost, userName, password, to, cc, subject, body, attachments);

        email.send(); // 发送！
    }
}
